﻿using System;
using System.Data;
using System.Text;
using System.Collections.Generic;
using Microsoft.Practices.EnterpriseLibrary.Data;
using Microsoft.Practices.EnterpriseLibrary.Data.Sql;
using System.Data.Common;

namespace Chenxin.Lib.House.DAL
{
    /// <summary>
    /// 数据访问类House_EntrustInfo。
    /// </summary>
    public class House_EntrustInfo
    {
        public House_EntrustInfo()
        { }
        #region  成员方法

        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public static bool Exists(Guid EntrustId)
        {
            Database db = DatabaseFactory.CreateDatabase("Chenxin_House");
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select count(1) from House_EntrustInfo where EntrustId=@EntrustId ");
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            db.AddInParameter(dbCommand, "EntrustId", DbType.Guid, EntrustId);
            int cmdresult;
            object obj = db.ExecuteScalar(dbCommand);
            if ((Object.Equals(obj, null)) || (Object.Equals(obj, System.DBNull.Value)))
            {
                cmdresult = 0;
            }
            else
            {
                cmdresult = int.Parse(obj.ToString());
            }
            if (cmdresult == 0)
            {
                return false;
            }
            else
            {
                return true;
            }
        }


        /// <summary>
        /// 增加一条数据
        /// </summary>
        public static void Add(Chenxin.Lib.House.Entity.House_EntrustInfo model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into House_EntrustInfo(");
            strSql.Append("EntrustId,CityId,HouseId,HouseCode,HouseAddress,EntrustCode,HasApply,EmployeeId,Employee,EmpDepartId,EmpDepart,PropertyCode,InputTime,Memo,StartTime,EndTime,OperatorId,Operator,OptDepartId,OptDepart,CustomerId,CustomerName,Phone,Mobile,CustomerAddress,Nationality,AddressZip,ContactType,District,UnitPrice,TotalPrice,RentPrice,Area,EntrustType,Status,Type,OptCompanyId,OptCompany)");

            strSql.Append(" values (");
            strSql.Append("@EntrustId,@CityId,@HouseId,@HouseCode,@HouseAddress,@EntrustCode,@HasApply,@EmployeeId,@Employee,@EmpDepartId,@EmpDepart,@PropertyCode,@InputTime,@Memo,@StartTime,@EndTime,@OperatorId,@Operator,@OptDepartId,@OptDepart,@CustomerId,@CustomerName,@Phone,@Mobile,@CustomerAddress,@Nationality,@AddressZip,@ContactType,@District,@UnitPrice,@TotalPrice,@RentPrice,@Area,@EntrustType,@Status,@Type,@OptCompanyId,@OptCompany)");
            Database db = DatabaseFactory.CreateDatabase("Chenxin_House");
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            db.AddInParameter(dbCommand, "EntrustId", DbType.Guid, model.EntrustId);
            db.AddInParameter(dbCommand, "CityId", DbType.Guid, model.CityId);
            db.AddInParameter(dbCommand, "HouseId", DbType.Guid, model.HouseId);
            db.AddInParameter(dbCommand, "HouseCode", DbType.AnsiString, model.HouseCode);
            db.AddInParameter(dbCommand, "HouseAddress", DbType.AnsiString, model.HouseAddress);
            db.AddInParameter(dbCommand, "EntrustCode", DbType.AnsiString, model.EntrustCode);
            db.AddInParameter(dbCommand, "HasApply", DbType.Boolean, model.HasApply);
            db.AddInParameter(dbCommand, "EmployeeId", DbType.Guid, model.EmployeeId);
            db.AddInParameter(dbCommand, "Employee", DbType.AnsiString, model.Employee);
            db.AddInParameter(dbCommand, "EmpDepartId", DbType.Guid, model.EmpDepartId);
            db.AddInParameter(dbCommand, "EmpDepart", DbType.AnsiString, model.EmpDepart);
            db.AddInParameter(dbCommand, "PropertyCode", DbType.AnsiString, model.PropertyCode);
            db.AddInParameter(dbCommand, "InputTime", DbType.DateTime, model.InputTime);
            db.AddInParameter(dbCommand, "Memo", DbType.AnsiString, model.Memo);
            db.AddInParameter(dbCommand, "StartTime", DbType.DateTime, model.StartTime);
            db.AddInParameter(dbCommand, "EndTime", DbType.DateTime, model.EndTime);
            db.AddInParameter(dbCommand, "OperatorId", DbType.Guid, model.OperatorId);
            db.AddInParameter(dbCommand, "Operator", DbType.AnsiString, model.Operator);
            db.AddInParameter(dbCommand, "OptDepartId", DbType.Guid, model.OptDepartId);
            db.AddInParameter(dbCommand, "OptDepart", DbType.AnsiString, model.OptDepart);
            db.AddInParameter(dbCommand, "CustomerId", DbType.Guid, model.CustomerId);
            db.AddInParameter(dbCommand, "CustomerName", DbType.AnsiString, model.CustomerName);
            db.AddInParameter(dbCommand, "Phone", DbType.AnsiString, model.Phone);
            db.AddInParameter(dbCommand, "Mobile", DbType.AnsiString, model.Mobile);
            db.AddInParameter(dbCommand, "CustomerAddress", DbType.AnsiString, model.CustomerAddress);
            db.AddInParameter(dbCommand, "Nationality", DbType.AnsiString, model.Nationality);
            db.AddInParameter(dbCommand, "AddressZip", DbType.AnsiString, model.AddressZip);
            db.AddInParameter(dbCommand, "ContactType", DbType.AnsiString, model.ContactType);
            db.AddInParameter(dbCommand, "District", DbType.AnsiString, model.District);
            db.AddInParameter(dbCommand, "UnitPrice", DbType.Decimal, model.UnitPrice);
            db.AddInParameter(dbCommand, "TotalPrice", DbType.Decimal, model.TotalPrice);
            db.AddInParameter(dbCommand, "RentPrice", DbType.Decimal, model.RentPrice);
            db.AddInParameter(dbCommand, "Area", DbType.Decimal, model.Area);
            db.AddInParameter(dbCommand, "EntrustType", DbType.AnsiString, model.EntrustType);
            db.AddInParameter(dbCommand, "Status", DbType.Int32, model.Status);
            db.AddInParameter(dbCommand, "Type", DbType.AnsiString, model.Type);
            db.AddInParameter(dbCommand, "OptCompanyId", DbType.Guid, model.OptCompanyId);
            db.AddInParameter(dbCommand, "OptCompany", DbType.AnsiString, model.OptCompany);
            db.ExecuteNonQuery(dbCommand);
        }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public static void Update(Chenxin.Lib.House.Entity.House_EntrustInfo model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update House_EntrustInfo set ");
            strSql.Append("CityId=@CityId,");
            strSql.Append("HouseId=@HouseId,");
            strSql.Append("HouseCode=@HouseCode,");
            strSql.Append("HouseAddress=@HouseAddress,");
            strSql.Append("EntrustCode=@EntrustCode,");
            strSql.Append("HasApply=@HasApply,");
            strSql.Append("EmployeeId=@EmployeeId,");
            strSql.Append("Employee=@Employee,");
            strSql.Append("EmpDepartId=@EmpDepartId,");
            strSql.Append("EmpDepart=@EmpDepart,");
            strSql.Append("PropertyCode=@PropertyCode,");
            strSql.Append("InputTime=@InputTime,");
            strSql.Append("Memo=@Memo,");
            strSql.Append("StartTime=@StartTime,");
            strSql.Append("EndTime=@EndTime,");
            strSql.Append("OperatorId=@OperatorId,");
            strSql.Append("Operator=@Operator,");
            strSql.Append("OptDepartId=@OptDepartId,");
            strSql.Append("OptDepart=@OptDepart,");
            strSql.Append("CustomerId=@CustomerId,");
            strSql.Append("CustomerName=@CustomerName,");
            strSql.Append("Phone=@Phone,");
            strSql.Append("Mobile=@Mobile,");
            strSql.Append("CustomerAddress=@CustomerAddress,");
            strSql.Append("Nationality=@Nationality,");
            strSql.Append("AddressZip=@AddressZip,");
            strSql.Append("ContactType=@ContactType,");
            strSql.Append("District=@District,");
            strSql.Append("UnitPrice=@UnitPrice,");
            strSql.Append("TotalPrice=@TotalPrice,");
            strSql.Append("RentPrice=@RentPrice,");
            strSql.Append("Area=@Area,");
            strSql.Append("EntrustType=@EntrustType,");
            strSql.Append("Status=@Status,");
            strSql.Append("OptCompanyId=@OptCompanyId,");
            strSql.Append("OptCompany=@OptCompany,");
            strSql.Append("Type=@Type");
            strSql.Append(" where EntrustId=@EntrustId ");
            Database db = DatabaseFactory.CreateDatabase("Chenxin_House");
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            db.AddInParameter(dbCommand, "EntrustId", DbType.Guid, model.EntrustId);
            db.AddInParameter(dbCommand, "CityId", DbType.Guid, model.CityId);
            db.AddInParameter(dbCommand, "HouseId", DbType.Guid, model.HouseId);
            db.AddInParameter(dbCommand, "HouseCode", DbType.AnsiString, model.HouseCode);
            db.AddInParameter(dbCommand, "HouseAddress", DbType.AnsiString, model.HouseAddress);
            db.AddInParameter(dbCommand, "EntrustCode", DbType.AnsiString, model.EntrustCode);
            db.AddInParameter(dbCommand, "HasApply", DbType.Boolean, model.HasApply);
            db.AddInParameter(dbCommand, "EmployeeId", DbType.Guid, model.EmployeeId);
            db.AddInParameter(dbCommand, "Employee", DbType.AnsiString, model.Employee);
            db.AddInParameter(dbCommand, "EmpDepartId", DbType.Guid, model.EmpDepartId);
            db.AddInParameter(dbCommand, "EmpDepart", DbType.AnsiString, model.EmpDepart);
            db.AddInParameter(dbCommand, "PropertyCode", DbType.AnsiString, model.PropertyCode);
            db.AddInParameter(dbCommand, "InputTime", DbType.DateTime, model.InputTime);
            db.AddInParameter(dbCommand, "Memo", DbType.AnsiString, model.Memo);
            db.AddInParameter(dbCommand, "StartTime", DbType.DateTime, model.StartTime);
            db.AddInParameter(dbCommand, "EndTime", DbType.DateTime, model.EndTime);
            db.AddInParameter(dbCommand, "OperatorId", DbType.Guid, model.OperatorId);
            db.AddInParameter(dbCommand, "Operator", DbType.AnsiString, model.Operator);
            db.AddInParameter(dbCommand, "OptDepartId", DbType.Guid, model.OptDepartId);
            db.AddInParameter(dbCommand, "OptDepart", DbType.AnsiString, model.OptDepart);
            db.AddInParameter(dbCommand, "CustomerId", DbType.Guid, model.CustomerId);
            db.AddInParameter(dbCommand, "CustomerName", DbType.AnsiString, model.CustomerName);
            db.AddInParameter(dbCommand, "Phone", DbType.AnsiString, model.Phone);
            db.AddInParameter(dbCommand, "Mobile", DbType.AnsiString, model.Mobile);
            db.AddInParameter(dbCommand, "CustomerAddress", DbType.AnsiString, model.CustomerAddress);
            db.AddInParameter(dbCommand, "Nationality", DbType.AnsiString, model.Nationality);
            db.AddInParameter(dbCommand, "AddressZip", DbType.AnsiString, model.AddressZip);
            db.AddInParameter(dbCommand, "ContactType", DbType.AnsiString, model.ContactType);
            db.AddInParameter(dbCommand, "District", DbType.AnsiString, model.District);
            db.AddInParameter(dbCommand, "UnitPrice", DbType.Decimal, model.UnitPrice);
            db.AddInParameter(dbCommand, "TotalPrice", DbType.Decimal, model.TotalPrice);
            db.AddInParameter(dbCommand, "RentPrice", DbType.Decimal, model.RentPrice);
            db.AddInParameter(dbCommand, "Area", DbType.Decimal, model.Area);
            db.AddInParameter(dbCommand, "EntrustType", DbType.AnsiString, model.EntrustType);
            db.AddInParameter(dbCommand, "Status", DbType.Int32, model.Status);
            db.AddInParameter(dbCommand, "Type", DbType.AnsiString, model.Type);
            db.AddInParameter(dbCommand, "OptCompanyId", DbType.Guid, model.OptCompanyId);
            db.AddInParameter(dbCommand, "OptCompany", DbType.AnsiString, model.OptCompany);
            db.ExecuteNonQuery(dbCommand);

        }

        /// <summary>
        /// 删除一条数据
        /// </summary>
        public static void Delete(Guid EntrustId)
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("delete from House_EntrustInfo ");
            strSql.Append(" where EntrustId=@EntrustId ");
            Database db = DatabaseFactory.CreateDatabase("Chenxin_House");
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            db.AddInParameter(dbCommand, "EntrustId", DbType.Guid, EntrustId);
            db.ExecuteNonQuery(dbCommand);

        }

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public static Chenxin.Lib.House.Entity.House_EntrustInfo GetModel(Guid EntrustId)
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("select EntrustId,CityId,HouseId,HouseCode,HouseAddress,EntrustCode,HasApply,EmployeeId,Employee,EmpDepartId,EmpDepart,PropertyCode,InputTime,Memo,StartTime,EndTime,OperatorId,Operator,OptDepartId,OptDepart,CustomerId,CustomerName,Phone,Mobile,CustomerAddress,Nationality,AddressZip,ContactType,District,UnitPrice,TotalPrice,RentPrice,Area,EntrustType,Status,Type,OptCompanyId,OptCompany from House_EntrustInfo ");
            strSql.Append(" where EntrustId=@EntrustId ");
            Database db = DatabaseFactory.CreateDatabase("Chenxin_House_Search");
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            db.AddInParameter(dbCommand, "EntrustId", DbType.Guid, EntrustId);
            Chenxin.Lib.House.Entity.House_EntrustInfo model = null;
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    model = ReaderBind(dataReader);
                }
                dataReader.Close();
                dataReader.Dispose();
            }
            return model;
        }

        /// <summary>
        /// 分页获取数据列表
        /// </summary>
        public static DataSet GetList(int PageIndex, int PageSize, String OrderField, string TableName, string StrWhere, string FieldList, string TableFieldList, bool DoCount)
        {
            Database db = DatabaseFactory.CreateDatabase("Chenxin_House_Search");
            DbCommand dbCommand = db.GetStoredProcCommand("PagerMultiTable");
            db.AddInParameter(dbCommand, "PageIndex", DbType.Int32, PageIndex);
            db.AddInParameter(dbCommand, "PageSize", DbType.Int32, PageSize);
            db.AddInParameter(dbCommand, "OrderField", DbType.AnsiString, OrderField);
            db.AddInParameter(dbCommand, "TableName", DbType.AnsiString, TableName);
            db.AddInParameter(dbCommand, "StrWhere", DbType.AnsiString, StrWhere);
            db.AddInParameter(dbCommand, "FieldList", DbType.AnsiString, FieldList);
            db.AddInParameter(dbCommand, "TableFieldList", DbType.AnsiString, TableFieldList);
            db.AddInParameter(dbCommand, "DoCount", DbType.Boolean, DoCount);
            return db.ExecuteDataSet(dbCommand);
        }


        /// <summary>
        /// 获得数据列表
        /// </summary>
        public static DataSet GetList(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select EntrustId,CityId,HouseId,HouseCode,HouseAddress,EntrustCode,HasApply,EmployeeId,Employee,EmpDepartId,EmpDepart,PropertyCode,InputTime,Memo,StartTime,EndTime,OperatorId,Operator,OptDepartId,OptDepart,CustomerId,CustomerName,Phone,Mobile,CustomerAddress,Nationality,AddressZip,ContactType,District,UnitPrice,TotalPrice,RentPrice,Area,EntrustType,Status,Type,OptCompanyId,OptCompany ");
            strSql.Append(" FROM House_EntrustInfo ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            Database db = DatabaseFactory.CreateDatabase("Chenxin_House_Search");
            return db.ExecuteDataSet(CommandType.Text, strSql.ToString());
        }

        /*
        /// <summary>
        /// 分页获取数据列表
        /// </summary>
        public DataSet GetList(int PageSize,int PageIndex,string strWhere)
        {
            Database db = DatabaseFactory.CreateDatabase("Chenxin_House");
            DbCommand dbCommand = db.GetStoredProcCommand("UP_GetRecordByPage");
            db.AddInParameter(dbCommand, "tblName", DbType.AnsiString, "House_EntrustInfo");
            db.AddInParameter(dbCommand, "fldName", DbType.AnsiString, "ID");
            db.AddInParameter(dbCommand, "PageSize", DbType.Int32, PageSize);
            db.AddInParameter(dbCommand, "PageIndex", DbType.Int32, PageIndex);
            db.AddInParameter(dbCommand, "IsReCount", DbType.Boolean, 0);
            db.AddInParameter(dbCommand, "OrderType", DbType.Boolean, 0);
            db.AddInParameter(dbCommand, "strWhere", DbType.AnsiString, strWhere);
            return db.ExecuteDataSet(dbCommand);
        }*/

        /// <summary>
        /// 获得数据列表（比DataSet效率高，推荐使用）
        /// </summary>
        public static List<Chenxin.Lib.House.Entity.House_EntrustInfo> GetListArray(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select EntrustId,CityId,HouseId,HouseCode,HouseAddress,EntrustCode,HasApply,EmployeeId,Employee,EmpDepartId,EmpDepart,PropertyCode,InputTime,Memo,StartTime,EndTime,OperatorId,Operator,OptDepartId,OptDepart,CustomerId,CustomerName,Phone,Mobile,CustomerAddress,Nationality,AddressZip,ContactType,District,UnitPrice,TotalPrice,RentPrice,Area,EntrustType,Status,Type,OptCompanyId,OptCompany ");
            strSql.Append(" FROM House_EntrustInfo ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            List<Chenxin.Lib.House.Entity.House_EntrustInfo> list = new List<Chenxin.Lib.House.Entity.House_EntrustInfo>();
            Database db = DatabaseFactory.CreateDatabase("Chenxin_House_Search");
            using (IDataReader dataReader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
            {
                while (dataReader.Read())
                {
                    list.Add(ReaderBind(dataReader));
                }
                dataReader.Close();
                dataReader.Dispose();
            }
            return list;
        }


        /// <summary>
        /// 对象实体绑定数据
        /// </summary>
        public static Chenxin.Lib.House.Entity.House_EntrustInfo ReaderBind(IDataReader dataReader)
        {
            Chenxin.Lib.House.Entity.House_EntrustInfo model = new Chenxin.Lib.House.Entity.House_EntrustInfo();
            object ojb;
            ojb = dataReader["EntrustId"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.EntrustId = new Guid(ojb.ToString());
            }
            ojb = dataReader["CityId"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.CityId = new Guid(ojb.ToString());
            }
            ojb = dataReader["HouseId"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.HouseId = new Guid(ojb.ToString());
            }
            model.HouseCode = dataReader["HouseCode"].ToString();
            model.HouseAddress = dataReader["HouseAddress"].ToString();
            model.EntrustCode = dataReader["EntrustCode"].ToString();
            ojb = dataReader["HasApply"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.HasApply = (bool)ojb;
            }
            ojb = dataReader["EmployeeId"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.EmployeeId = new Guid(ojb.ToString());
            }
            model.Employee = dataReader["Employee"].ToString();
            ojb = dataReader["EmpDepartId"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.EmpDepartId = new Guid(ojb.ToString());
            }
            model.EmpDepart = dataReader["EmpDepart"].ToString();
            model.PropertyCode = dataReader["PropertyCode"].ToString();
            ojb = dataReader["InputTime"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.InputTime = (DateTime)ojb;
            }
            model.Memo = dataReader["Memo"].ToString();
            ojb = dataReader["StartTime"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.StartTime = (DateTime)ojb;
            }
            ojb = dataReader["EndTime"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.EndTime = (DateTime)ojb;
            }
            ojb = dataReader["OperatorId"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.OperatorId = new Guid(ojb.ToString());
            }
            model.Operator = dataReader["Operator"].ToString();
            ojb = dataReader["OptDepartId"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.OptDepartId = new Guid(ojb.ToString());
            }
            model.OptDepart = dataReader["OptDepart"].ToString();
            ojb = dataReader["CustomerId"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.CustomerId = new Guid(ojb.ToString());
            }
            model.CustomerName = dataReader["CustomerName"].ToString();
            model.Phone = dataReader["Phone"].ToString();
            model.Mobile = dataReader["Mobile"].ToString();
            model.CustomerAddress = dataReader["CustomerAddress"].ToString();
            model.Nationality = dataReader["Nationality"].ToString();
            model.AddressZip = dataReader["AddressZip"].ToString();
            model.ContactType = dataReader["ContactType"].ToString();
            model.District = dataReader["District"].ToString();
            ojb = dataReader["UnitPrice"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.UnitPrice = (decimal)ojb;
            }
            ojb = dataReader["TotalPrice"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.TotalPrice = (decimal)ojb;
            }
            ojb = dataReader["RentPrice"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.RentPrice = (decimal)ojb;
            }
            ojb = dataReader["Area"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.Area = (decimal)ojb;
            }
            model.EntrustType = dataReader["EntrustType"].ToString();
            ojb = dataReader["Status"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.Status = (int)ojb;
            }
            model.Type = dataReader["Type"].ToString();

            ojb = dataReader["OptCompanyId"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.OptCompanyId = new Guid(ojb.ToString());
            }
            model.OptCompany = dataReader["OptCompany"].ToString();

            return model;
        }


        public static void CancelEntrustInfo(Guid entrustId)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("Update House_EntrustInfo Set Status = -1 ");
            strSql.Append(" where EntrustId=@EntrustId ");
            Database db = DatabaseFactory.CreateDatabase("Chenxin_House");
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            db.AddInParameter(dbCommand, "EntrustId", DbType.Guid, entrustId);
            db.ExecuteNonQuery(dbCommand);

        }

        public static void RestoreEntrustInfo(Guid entrustId)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("Update House_EntrustInfo Set Status = 0 ");
            strSql.Append(" where EntrustId=@EntrustId ");
            Database db = DatabaseFactory.CreateDatabase("Chenxin_House");
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            db.AddInParameter(dbCommand, "EntrustId", DbType.Guid, entrustId);
            db.ExecuteNonQuery(dbCommand);

        }

        #endregion  成员方法
    }
}

